﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
using YArchitech.BIM;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace YArchitech.HYSpace
{
	public partial class FrmShowInfoGrid : System.Windows.Forms.Form
	{
		public FrmShowInfoGrid()
		{
			this.InitializeComponent();
			this.SetTreeViewFocus(this.tvSpaceClass);
		}

		public FrmShowInfoGrid(int roomTypeId, string operate)
		{
			this.InitializeComponent();
			this.SetTreeViewFocus(this.tvSpaceClass);
			this.rTypeId = roomTypeId;
			this.btnOperate = operate;
		}

		private void FrmShowInfoGrid_Load(object sender, EventArgs e)
		{
			this.isInit = true;
			base.Icon = Resource.YArchitechIcon;
			this.btnAdd.Image = Resources.AddNew16;
			this.btnModify.Image = Resources.modify16;
			this.btnDelete.Image = Resources.delete16;
			this.SetTreeViewFocus(this.tvSpaceClass);
			this.InitData();
			this.SetGridLeave();
		}

		private void InitData()
		{
			FrmShowInfoGrid.loadParam = new LoadParamOperate();
			FrmShowInfoGrid.listSPI = FrmShowInfoGrid.loadParam.GetAllSpaceInfo();
			FrmShowInfoGrid.listTAssign = FrmShowInfoGrid.loadParam.GetAllTimeInfo();
			this.tvSpaceClass.Nodes.Clear();
			this.InitialInterface(FrmShowInfoGrid.listSPI, 0, 0);
			if (this.rTypeId > 0)
			{
				string b = "";
				int parentNum = 0;
				int childNum = 0;
				foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
				{
					if (spaceParameterInfo.RoomId == this.rTypeId)
					{
						b = spaceParameterInfo.RoomName;
					}
				}
				foreach (object obj in this.tvSpaceClass.Nodes)
				{
					foreach (object obj2 in ((TreeNode)obj).Nodes)
					{
						TreeNode treeNode = (TreeNode)obj2;
						if (treeNode.Text == b)
						{
							parentNum = treeNode.Parent.Index;
							childNum = treeNode.Index;
						}
					}
				}
				this.InitialInterface(FrmShowInfoGrid.listSPI, parentNum, childNum);
			}
			foreach (SpaceParameterInfo spaceParameterInfo2 in FrmShowInfoGrid.listSPI)
			{
				spaceParameterInfo2.Operation = "无操作";
			}
		}

		private void SetGridLeave()
		{
			this.PropertyGridInfo.Leave += this.GridLeave;
		}

		private void GridLeave(object sender, EventArgs e)
		{
			if (base.ActiveControl == this.btnExit)
			{
				return;
			}
			if (!this.isChangeSucceed)
			{
				YJKMessageBox.Show("请输入合适的参数");
				this.PropertyGridInfo.Select();
				return;
			}
		}

		private void SetTreeViewFocus(TreeView tv)
		{
			tv.HideSelection = false;
			tv.DrawMode = TreeViewDrawMode.OwnerDrawText;
			tv.DrawNode += this.tvSpaceUse_DrawNode;
		}

		private void tvSpaceUse_DrawNode(object sender, DrawTreeNodeEventArgs e)
		{
			e.DrawDefault = true;
			if ((e.State & TreeNodeStates.Selected) != (TreeNodeStates)0)
			{
				e.Graphics.FillRectangle(Brushes.DarkBlue, e.Node.Bounds);
				Font font = e.Node.NodeFont;
				if (font == null)
				{
					font = ((TreeView)sender).Font;
				}
				e.Graphics.DrawString(e.Node.Text, font, Brushes.White, Rectangle.Inflate(e.Bounds, 2, 0));
			}
			else
			{
				e.DrawDefault = true;
			}
			if ((e.State & TreeNodeStates.Focused) != (TreeNodeStates)0)
			{
				using (Pen pen = new Pen(Color.Black))
				{
					pen.DashStyle = DashStyle.Dot;
					Rectangle bounds = e.Node.Bounds;
					bounds.Size = new Size(bounds.Width - 1, bounds.Height - 1);
					e.Graphics.DrawRectangle(pen, bounds);
				}
			}
		}

		private void InitialInterface(IList<SpaceParameterInfo> listSPI, int parentNum, int childNum)
		{
			IList<int> list = new List<int>();
			if (this.isInit)
			{
				foreach (SpaceParameterInfo spaceParameterInfo in listSPI)
				{
					if (!list.Contains(spaceParameterInfo.RoomTypeId))
					{
						TreeNode treeNode = TreeViewTools.CreatTreeViewNode(spaceParameterInfo.RoomTypeName, spaceParameterInfo.RoomTypeId.ToString());
						list.Add(spaceParameterInfo.RoomTypeId);
						foreach (SpaceParameterInfo spaceParameterInfo2 in listSPI)
						{
							if (spaceParameterInfo.RoomTypeName == spaceParameterInfo2.RoomTypeName)
							{
								TreeNode treeNode2 = TreeViewTools.CreatTreeViewNode(spaceParameterInfo2.RoomName, spaceParameterInfo2.RoomId.ToString());
								treeNode2.Name = spaceParameterInfo2.RoomId.ToString();
								treeNode.Nodes.Add(treeNode2);
							}
						}
						this.tvSpaceClass.Nodes.Add(treeNode);
					}
				}
				this.isInit = false;
			}
			this.tvSpaceClass.SelectedNode = this.tvSpaceClass.Nodes[parentNum].Nodes[childNum];
			this.tvSpaceClass.Select();
			this.tvSpaceClass.Focus();
			int num = Convert.ToInt32(this.tvSpaceClass.SelectedNode.Name);
			foreach (SpaceParameterInfo spaceParameterInfo3 in listSPI)
			{
				if (spaceParameterInfo3.RoomId == num)
				{
					this.BandPropertyGrid(spaceParameterInfo3);
					break;
				}
			}
		}

		private void BandPropertyGrid(SpaceParameterInfo spi)
		{
			PropertyGridMgr propertyGridMgr = new PropertyGridMgr();
			foreach (SpacePara spacePara in spi.Param)
			{
				if (spacePara != null && !(spacePara.Key == "ID"))
				{
					if (spacePara.Key == "盈建科-劳动强度(enum)")
					{
						string[] array = new string[]
						{
							"静坐",
							"极轻劳动",
							"轻度劳动",
							"中度劳动",
							"重度劳动"
						};
						int num = (int)Enum.Parse(typeof(LaborIntensity), spacePara.Value);
						propertyGridMgr.Add(new PropertyGridItem(spacePara.Key, array[num], false, true)
						{
							Category = spacePara.Group,
							Converter = new DropDownListConverter(array)
						});
					}
					else
					{
						PropertyGridItem propertyGridItem = new PropertyGridItem(spacePara.Key, spacePara.Value, false, true);
						propertyGridItem.Category = spacePara.Group;
						string key = spacePara.Key;
						if (key == "盈建科-人员时间表" || key == "盈建科-新风时间表" || key == "盈建科-照明时间表" || key == "盈建科-电动设备时间表" || key == "盈建科-电子设备时间表" || key == "盈建科-电热设备时间表")
						{
							propertyGridItem.Editor = new Editor();
						}
						propertyGridMgr.Add(propertyGridItem);
					}
				}
			}
			this.PropertyGridInfo.SelectedObject = propertyGridMgr;
		}

		private void PropertyGridInfo_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
		{
			this.isChangeSucceed = true;
			bool flag = false;
			foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
			{
				if (spaceParameterInfo.RoomId == Convert.ToInt32(this.tvSpaceClass.SelectedNode.Tag))
				{
					if (spaceParameterInfo.Operation == "修改")
					{
						flag = true;
					}
					if (spaceParameterInfo.Operation != "添加" && !this.isTreeChange && !this.isInit)
					{
						spaceParameterInfo.Operation = "修改";
					}
					foreach (SpacePara spacePara in spaceParameterInfo.Param)
					{
						GridItem changedItem = e.ChangedItem;
						if (spacePara.Key == changedItem.Label)
						{
							if (changedItem.Label == "盈建科-劳动强度(enum)")
							{
								int num = 0;
								string a = changedItem.Value.ToString();
								if (!(a == "静坐"))
								{
									if (!(a == "极轻劳动"))
									{
										if (!(a == "轻度劳动"))
										{
											if (!(a == "中度劳动"))
											{
												if (a == "重度劳动")
												{
													num = 4;
												}
											}
											else
											{
												num = 3;
											}
										}
										else
										{
											num = 2;
										}
									}
									else
									{
										num = 1;
									}
								}
								else
								{
									num = 0;
								}
								spacePara.Value = num.ToString();
								break;
							}
							if (spacePara.Key.Contains("时间表"))
							{
								string tsParent = spacePara.Key.Replace("盈建科-", "").Replace("时间表", "");
								if (FrmShowInfoGrid.loadParam.IsEffectiveTimeAssignName(tsParent, changedItem.Value.ToString(), FrmShowInfoGrid.listTAssign))
								{
									spacePara.Value = changedItem.Value.ToString();
									break;
								}
								if (!flag)
								{
									spaceParameterInfo.Operation = "无操作";
								}
								this.isChangeSucceed = false;
								break;
							}
							else
							{
								try
								{
									double.Parse(changedItem.Value.ToString().Trim());
								}
								catch
								{
									if (!flag)
									{
										spaceParameterInfo.Operation = "无操作";
									}
									this.isChangeSucceed = false;
								}
								if ((spacePara.Key == "盈建科-夏季空调设计温度(℃)" || spacePara.Key == "盈建科-冬季空调设计温度(℃)" || spacePara.Key == "盈建科-冬季采暖设计温度(℃)") && this.isChangeSucceed)
								{
									string value = changedItem.Value.ToString();
									double num2 = Convert.ToDouble(value);
									if (num2 < 13.0 || num2 > 113.0)
									{
										if (!flag)
										{
											spaceParameterInfo.Operation = "无操作";
										}
										this.isChangeSucceed = false;
										break;
									}
									spacePara.Value = value;
									break;
								}
								else if (spacePara.Key.Contains("同时使用系数") && this.isChangeSucceed)
								{
									string value2 = changedItem.Value.ToString();
									double num3 = Convert.ToDouble(value2);
									if (num3 < 0.0 || num3 > 1.0)
									{
										spaceParameterInfo.Operation = "无操作";
										this.isChangeSucceed = false;
										break;
									}
									spacePara.Value = value2;
									break;
								}
								else if (spacePara.Key.Contains("(%)") && this.isChangeSucceed)
								{
									string value3 = changedItem.Value.ToString();
									double num4 = Convert.ToDouble(value3);
									if (num4 < 0.0 || num4 > 100.0)
									{
										if (!flag)
										{
											spaceParameterInfo.Operation = "无操作";
										}
										this.isChangeSucceed = false;
										break;
									}
									spacePara.Value = value3;
									break;
								}
								else
								{
									if (this.isChangeSucceed)
									{
										spacePara.Value = changedItem.Value.ToString();
										break;
									}
									break;
								}
							}
						}
					}
				}
			}
		}

		private void tvSpaceClass_AfterSelect(object sender, TreeViewEventArgs e)
		{
			try
			{
				this.isTreeChange = true;
				if (this.tvSpaceClass.SelectedNode.Parent != null)
				{
					foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
					{
						if (this.tvSpaceClass.SelectedNode.Tag.ToString() == spaceParameterInfo.RoomId.ToString())
						{
							this.BandPropertyGrid(spaceParameterInfo);
						}
					}
				}
				this.isTreeChange = false;
			}
			catch (Exception)
			{
				this.isTreeChange = false;
				throw;
			}
		}

		private void btnAdd_Click(object sender, EventArgs e)
		{
			int num = 0;
			int num2;
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				num2 = Convert.ToInt32(this.tvSpaceClass.SelectedNode.Tag);
				num = this.tvSpaceClass.SelectedNode.Index;
			}
			else
			{
				num2 = Convert.ToInt32(this.tvSpaceClass.SelectedNode.Parent.Tag);
				num = this.tvSpaceClass.SelectedNode.Parent.Index;
				int childNum = this.tvSpaceClass.SelectedNode.Index;
			}
			if (num2 > 0)
			{
				FrmAddRoomName frmAddRoomName = new FrmAddRoomName(num2);
				if (frmAddRoomName.ShowDialog() == DialogResult.Yes)
				{
					SpaceParameterInfo spaceParameterInfo = new SpaceParameterInfo();
					foreach (SpaceParameterInfo spaceParameterInfo2 in FrmShowInfoGrid.listSPI)
					{
						if (frmAddRoomName.roomTID == spaceParameterInfo2.RoomTypeId)
						{
							int num3 = FrmShowInfoGrid.loadParam.GetMaxUseID();
							foreach (SpaceParameterInfo spaceParameterInfo3 in FrmShowInfoGrid.listSPI)
							{
								if (spaceParameterInfo3.RoomId > num3)
								{
									num3 = spaceParameterInfo3.RoomId;
								}
							}
							spaceParameterInfo.RoomId = num3 + 1;
							spaceParameterInfo.Operation = "添加";
							spaceParameterInfo.RoomName = frmAddRoomName.roomName;
							spaceParameterInfo.Param = new List<SpacePara>();
							foreach (SpacePara spacePara in spaceParameterInfo2.Param)
							{
								SpacePara spacePara2 = new SpacePara();
								spacePara2.Key = spacePara.Key;
								spacePara2.Value = spacePara.Value;
								spacePara2.Group = spacePara.Group;
								spaceParameterInfo.Param.Add(spacePara2);
							}
							spaceParameterInfo.RoomTypeId = spaceParameterInfo2.RoomTypeId;
							spaceParameterInfo.RoomTypeName = spaceParameterInfo2.RoomTypeName;
							foreach (object obj in this.tvSpaceClass.Nodes)
							{
								TreeNode treeNode = (TreeNode)obj;
								if (treeNode.Nodes.Count > 0 && treeNode.Text == spaceParameterInfo2.RoomTypeName)
								{
									num = treeNode.Index;
									break;
								}
							}
						}
					}
					this.isInit = true;
					FrmShowInfoGrid.listSPI.Add(spaceParameterInfo);
					int childNum = this.tvSpaceClass.Nodes[num].Nodes.Count;
					this.tvSpaceClass.Nodes.Clear();
					this.InitialInterface(FrmShowInfoGrid.listSPI, num, childNum);
					this.tvSpaceClass.LabelEdit = false;
				}
			}
		}

		private void btnModify_Click(object sender, EventArgs e)
		{
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				return;
			}
			int index = this.tvSpaceClass.SelectedNode.Parent.Index;
			int index2 = this.tvSpaceClass.SelectedNode.Index;
			this.tvSpaceClass.LabelEdit = false;
			int num = Convert.ToInt32(this.tvSpaceClass.SelectedNode.Tag);
			FrmModifyRoomName frmModifyRoomName = new FrmModifyRoomName(num);
			if (frmModifyRoomName.ShowDialog() == DialogResult.Yes)
			{
				new LoadCirculation();
				foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
				{
					if (num == spaceParameterInfo.RoomId)
					{
						spaceParameterInfo.RoomName = frmModifyRoomName.roomName;
						if (spaceParameterInfo.Operation != "添加")
						{
							spaceParameterInfo.Operation = "修改";
							break;
						}
						break;
					}
				}
			}
			this.tvSpaceClass.Nodes.Clear();
			this.isInit = true;
			this.InitialInterface(FrmShowInfoGrid.listSPI, index, index2);
		}

		private void btnDelete_Click(object sender, EventArgs e)
		{
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				return;
			}
			if (this.tvSpaceClass.SelectedNode.Parent.Nodes.Count <= 1)
			{
				return;
			}
			if (YJKMessageBox.Show("确认要删除数据？", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
			{
				int parentNum = 0;
				int num = 0;
				int childNum = 0;
				parentNum = this.tvSpaceClass.SelectedNode.Parent.Index;
				num = this.tvSpaceClass.SelectedNode.Index;
				childNum = num - 1;
				new SpaceParameterInfo();
				foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
				{
					if (this.tvSpaceClass.SelectedNode.Tag.ToString() == spaceParameterInfo.RoomId.ToString())
					{
						if (spaceParameterInfo.Operation != "添加")
						{
							spaceParameterInfo.Operation = "删除";
							this.listDeleteSPI.Add(spaceParameterInfo);
						}
						FrmShowInfoGrid.listSPI.Remove(spaceParameterInfo);
						break;
					}
				}
				this.tvSpaceClass.Nodes.Clear();
				this.isInit = true;
				this.isTreeChange = true;
				if (num < 1)
				{
					childNum = num;
				}
				this.InitialInterface(FrmShowInfoGrid.listSPI, parentNum, childNum);
			}
		}

		private void btnSave_Click(object sender, EventArgs e)
		{
			if (this.JudgeWDInfo())
			{
				return;
			}
			int parentNum = 0;
			int childNum = 0;
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				parentNum = this.tvSpaceClass.SelectedNode.Index;
				childNum = 0;
			}
			else
			{
				parentNum = this.tvSpaceClass.SelectedNode.Parent.Index;
				childNum = this.tvSpaceClass.SelectedNode.Index;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			FrmShowInfoGrid.loadParam = new LoadParamOperate();
			foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
			{
				string operation = spaceParameterInfo.Operation;
				if (!(operation == "添加"))
				{
					if (operation == "修改")
					{
						if (FrmShowInfoGrid.loadParam.UpdateSpaceParameterInfo(spaceParameterInfo))
						{
							num2++;
							spaceParameterInfo.Operation = "无操作";
						}
					}
				}
				else
				{
					int num4 = FrmShowInfoGrid.loadParam.GetMaxLoadID();
					foreach (SpaceParameterInfo spi in FrmShowInfoGrid.listSPI)
					{
						SpaceLoadParameter spaceLoadParameter = FrmShowInfoGrid.loadParam.TranformSpaceInfo(spi);
						if (spaceLoadParameter.Id > num4)
						{
							num4 = spaceLoadParameter.Id;
						}
					}
					if (FrmShowInfoGrid.loadParam.AddSpaceParameterInfo(spaceParameterInfo, num4 + 1))
					{
						num++;
						spaceParameterInfo.Operation = "无操作";
					}
				}
			}
			foreach (SpaceParameterInfo spaceParameterInfo2 in this.listDeleteSPI)
			{
				FrmShowInfoGrid.loadParam.DeleteSpaceParameterByRoomUse(spaceParameterInfo2.RoomId);
				num3++;
				spaceParameterInfo2.Operation = "无操作";
			}
			this.listDeleteSPI = new List<SpaceParameterInfo>();
			this.tvSpaceClass.Nodes.Clear();
			this.isInit = true;
			this.isTreeChange = true;
			this.InitialInterface(FrmShowInfoGrid.listSPI, parentNum, childNum);
			if (num > 0 || num2 > 0 || num3 > 0)
			{
				string text = "";
				if (num > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"添加",
						num,
						"条数据"
					});
				}
				if (!string.IsNullOrEmpty(text))
				{
					text += "\n";
				}
				if (num2 > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"修改",
						num2,
						"条数据"
					});
				}
				if (!string.IsNullOrEmpty(text))
				{
					text += "\n";
				}
				if (num3 > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"删除",
						num3,
						"条数据"
					});
				}
				YJKMessageBox.Show(text);
			}
		}

		private bool JudgeWDInfo()
		{
			return false;
		}

		private void btnSure_Click(object sender, EventArgs e)
		{
			if (this.JudgeWDInfo())
			{
				return;
			}
			int parentNum = 0;
			int childNum = 0;
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				parentNum = this.tvSpaceClass.SelectedNode.Index;
				childNum = 0;
			}
			else
			{
				parentNum = this.tvSpaceClass.SelectedNode.Parent.Index;
				childNum = this.tvSpaceClass.SelectedNode.Index;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			FrmShowInfoGrid.loadParam = new LoadParamOperate();
			foreach (SpaceParameterInfo spaceParameterInfo in FrmShowInfoGrid.listSPI)
			{
				string operation = spaceParameterInfo.Operation;
				if (!(operation == "添加"))
				{
					if (operation == "修改")
					{
						if (FrmShowInfoGrid.loadParam.UpdateSpaceParameterInfo(spaceParameterInfo))
						{
							num2++;
							spaceParameterInfo.Operation = "无操作";
						}
					}
				}
				else
				{
					int num4 = FrmShowInfoGrid.loadParam.GetMaxLoadID();
					foreach (SpaceParameterInfo spi in FrmShowInfoGrid.listSPI)
					{
						SpaceLoadParameter spaceLoadParameter = FrmShowInfoGrid.loadParam.TranformSpaceInfo(spi);
						if (spaceLoadParameter.Id > num4)
						{
							num4 = spaceLoadParameter.Id;
						}
					}
					if (FrmShowInfoGrid.loadParam.AddSpaceParameterInfo(spaceParameterInfo, num4 + 1))
					{
						num++;
						spaceParameterInfo.Operation = "无操作";
					}
				}
			}
			foreach (SpaceParameterInfo spaceParameterInfo2 in this.listDeleteSPI)
			{
				FrmShowInfoGrid.loadParam.DeleteSpaceParameterByRoomUse(spaceParameterInfo2.RoomId);
				num3++;
				spaceParameterInfo2.Operation = "无操作";
			}
			this.listDeleteSPI = new List<SpaceParameterInfo>();
			this.tvSpaceClass.Nodes.Clear();
			this.isInit = true;
			this.isTreeChange = true;
			this.InitialInterface(FrmShowInfoGrid.listSPI, parentNum, childNum);
			if (num > 0 || num2 > 0 || num3 > 0)
			{
				string text = "";
				if (num > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"添加",
						num,
						"条数据"
					});
				}
				if (!string.IsNullOrEmpty(text))
				{
					text += "\n";
				}
				if (num2 > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"修改",
						num2,
						"条数据"
					});
				}
				if (!string.IsNullOrEmpty(text))
				{
					text += "\n";
				}
				if (num3 > 0)
				{
					text = string.Concat(new object[]
					{
						text,
						"删除",
						num3,
						"条数据"
					});
				}
				YJKMessageBox.Show(text);
			}
			if (!(this.btnOperate == "CONTINUE"))
			{
				base.DialogResult = DialogResult.OK;
				return;
			}
			if (this.tvSpaceClass.SelectedNode.Parent == null)
			{
				return;
			}
			foreach (SpaceParameterInfo spaceParameterInfo3 in FrmShowInfoGrid.listSPI)
			{
				if (this.tvSpaceClass.SelectedNode.Tag.ToString() == spaceParameterInfo3.RoomId.ToString())
				{
					this.selRoomId = spaceParameterInfo3.RoomId;
				}
			}
			base.DialogResult = DialogResult.Yes;
		}

		private void btnExit_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		private void PropertyGridInfo_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
		{
			if (!this.isChangeSucceed)
			{
				this.isChangeSucceed = true;
				this.PropertyGridInfo.SelectedGridItem = e.OldSelection;
				if (this.PropertyGridInfo.SelectedGridItem.Label.Contains("时间表"))
				{
					YJKMessageBox.Show("请输入有效的时间指派名称!");
				}
				else if (this.PropertyGridInfo.SelectedGridItem.Label == "盈建科-夏季空调设计温度(℃)" || this.PropertyGridInfo.SelectedGridItem.Label == "盈建科-冬季空调设计温度(℃)" || this.PropertyGridInfo.SelectedGridItem.Label == "盈建科-冬季采暖设计温度(℃)")
				{
					YJKMessageBox.Show("设计温度应该在13-113间");
				}
				else if (this.PropertyGridInfo.SelectedGridItem.Label.Contains("同时使用系数"))
				{
					YJKMessageBox.Show("同时使用系数应该在0-1间");
				}
				else if (this.PropertyGridInfo.SelectedGridItem.Label.Contains("(%)"))
				{
					YJKMessageBox.Show("请输入0-100之间的数值");
				}
				else
				{
					YJKMessageBox.Show("请输入数字!");
				}
				this.isChangeSucceed = false;
			}
		}

		private void btnIn_Click(object sender, EventArgs e)
		{
			try
			{
				OpenFileDialog openFileDialog = new OpenFileDialog();
				openFileDialog.Filter = "XML空间数据文件(*.xml)|*.xml|所有文件|*.*";
				if (openFileDialog.ShowDialog() == DialogResult.OK)
				{
					if (!File.Exists(openFileDialog.FileName))
					{
						YJKMessageBox.Show("选择的数据文件不存在！");
					}
					else
					{
						string destFileName = Product.UserDataLocation + "\\HYSpaceInfo.xml";
						File.Copy(openFileDialog.FileName, destFileName, true);
						this.isInit = true;
						this.InitData();
						YJKMessageBox.Show("数据导入成功！");
					}
				}
			}
			catch (Exception ex)
			{
				YJKMessageBox.Show(ex.Message);
			}
		}

		private void btnOut_Click(object sender, EventArgs e)
		{
			try
			{
				SaveFileDialog saveFileDialog = new SaveFileDialog();
				saveFileDialog.Filter = "XML空间数据文件(*.xml)|*.xml|所有文件|*.*";
				if (saveFileDialog.ShowDialog() == DialogResult.OK)
				{
					string text = Product.UserDataLocation + "\\HYSpaceInfo.xml";
					if (!File.Exists(text))
					{
						YJKMessageBox.Show("数据文件不存在！");
					}
					else
					{
						File.Copy(text, saveFileDialog.FileName, true);
						YJKMessageBox.Show("数据导出成功！");
					}
				}
			}
			catch (Exception ex)
			{
				YJKMessageBox.Show(ex.Message);
			}
		}

		public static IList<SpaceParameterInfo> listSPI = new List<SpaceParameterInfo>();

		private IList<SpaceParameterInfo> listDeleteSPI = new List<SpaceParameterInfo>();

		public static IList<TimeAssign> listTAssign = new List<TimeAssign>();

		private int rTypeId;

		private string btnOperate = "NOT";

		public int selRoomId;

		private bool isTreeChange = true;

		private bool isInit;

		private bool isChangeSucceed = true;

		public static LoadParamOperate loadParam = null;
	}
}
